﻿// Type: System.ServiceModel.DomainServices.Client.DomainContext
// Assembly: System.ServiceModel.DomainServices.Client, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// Assembly location: C:\Program Files (x86)\Microsoft SDKs\RIA Services\v1.0\Libraries\Silverlight\System.ServiceModel.DomainServices.Client.dll

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.ServiceModel.DomainServices;
using System.Threading;

namespace System.ServiceModel.DomainServices.Client
{
  public abstract class DomainContext : INotifyPropertyChanged
  {
    private static MethodInfo createLoadOperationMethod = typeof (LoadOperation).GetMethod("Create", BindingFlags.Static | BindingFlags.NonPublic);
    private static MethodInfo createInvokeOperationMethod = typeof (InvokeOperation).GetMethod("Create", BindingFlags.Static | BindingFlags.NonPublic);
    private Dictionary<string, bool> requiresValidationMap = new Dictionary<string, bool>();
    private object _syncRoot = new object();
    internal const int TotalCountUndefined = -1;
    private int _activeLoadCount;
    private DomainClient _domainClient;
    private EntityContainer _entityContainer;
    private SynchronizationContext _syncContext;
    private ValidationContext _validationContext;
    private bool _isSubmitting;
    private PropertyChangedEventHandler PropertyChanged;

    public DomainClient DomainClient
    {
      get
      {
        if (this._domainClient.EntityTypes == null)
          this._domainClient.EntityTypes = Enumerable.Select<EntitySet, Type>(this.EntityContainer.EntitySets, (Func<EntitySet, Type>) (p => p.EntityType));
        return this._domainClient;
      }
    }

    public bool IsLoading
    {
      get
      {
        return this._activeLoadCount > 0;
      }
    }

    public bool IsSubmitting
    {
      get
      {
        return this._isSubmitting;
      }
      private set
      {
        this._isSubmitting = value;
        this.RaisePropertyChanged("IsSubmitting");
      }
    }

    public EntityContainer EntityContainer
    {
      get
      {
        if (this._entityContainer == null)
        {
          this._entityContainer = this.CreateEntityContainer();
          if (this._entityContainer == null)
            throw new InvalidOperationException(Resource.DomainContext_EntityContainerCannotBeNull);
          this._entityContainer.ValidationContext = this.ValidationContext;
          this._entityContainer.PropertyChanged += new PropertyChangedEventHandler(this.EntityContainerPropertyChanged);
        }
        return this._entityContainer;
      }
    }

    public bool HasChanges
    {
      get
      {
        return this.EntityContainer.HasChanges;
      }
    }

    public ValidationContext ValidationContext
    {
      get
      {
        return this._validationContext;
      }
      set
      {
        this._validationContext = value;
        this.EntityContainer.ValidationContext = value;
      }
    }

    public event PropertyChangedEventHandler PropertyChanged
    {
      add
      {
        PropertyChangedEventHandler changedEventHandler = this.PropertyChanged;
        PropertyChangedEventHandler comparand;
        do
        {
          comparand = changedEventHandler;
          changedEventHandler = Interlocked.CompareExchange<PropertyChangedEventHandler>(ref this.PropertyChanged, comparand + value, comparand);
        }
        while (changedEventHandler != comparand);
      }
      remove
      {
        PropertyChangedEventHandler changedEventHandler = this.PropertyChanged;
        PropertyChangedEventHandler comparand;
        do
        {
          comparand = changedEventHandler;
          changedEventHandler = Interlocked.CompareExchange<PropertyChangedEventHandler>(ref this.PropertyChanged, comparand - value, comparand);
        }
        while (changedEventHandler != comparand);
      }
    }

    static DomainContext()
    {
    }

    protected DomainContext(DomainClient domainClient)
    {
      if (domainClient == null)
        throw new ArgumentNullException("domainClient");
      this._domainClient = domainClient;
      this._syncContext = SynchronizationContext.Current ?? new SynchronizationContext();
    }

    protected abstract EntityContainer CreateEntityContainer();

    public void AddReference(Type entityType, DomainContext domainContext)
    {
      if (entityType == null)
        throw new ArgumentNullException("entityType");
      if (domainContext == null)
        throw new ArgumentNullException("domainContext");
      this.EntityContainer.AddReference(domainContext.EntityContainer.GetEntitySet(entityType));
    }

    public void RejectChanges()
    {
      this.EntityContainer.RejectChanges();
    }

    public SubmitOperation SubmitChanges()
    {
      return this.SubmitChanges((Action<SubmitOperation>) null, (object) null);
    }

    public virtual SubmitOperation SubmitChanges(Action<SubmitOperation> callback, object userState)
    {
      if (this.IsSubmitting)
        throw new InvalidOperationException(Resource.DomainContext_SubmitAlreadyInProgress);
      this.IsSubmitting = true;
      EntityChangeSet changeSet = (EntityChangeSet) null;
      SubmitOperation submitOperation;
      try
      {
        changeSet = this.EntityContainer.GetChanges();
        bool validChangeset = this.ValidateChangeSet(changeSet, this.ValidationContext);
        IAsyncResult result = (IAsyncResult) null;
        Action<SubmitOperation> cancelAction = (Action<SubmitOperation>) null;
        if (this.DomainClient.SupportsCancellation)
          cancelAction = (Action<SubmitOperation>) (op =>
          {
            if (result != null)
              this.DomainClient.CancelSubmit(result);
            this.IsSubmitting = false;
            foreach (Entity item_2 in (IEnumerable<Entity>) changeSet)
              item_2.IsSubmitting = false;
          });
        submitOperation = new SubmitOperation(changeSet, callback, userState, cancelAction);
        if (changeSet.IsEmpty || !validChangeset)
        {
          this._syncContext.Post((SendOrPostCallback) delegate
          {
            this.IsSubmitting = false;
            if (submitOperation.IsComplete)
              return;
            if (!validChangeset)
              submitOperation.Complete(OperationErrorStatus.ValidationFailed);
            else
              submitOperation.Complete();
          }, (object) null);
        }
        else
        {
          foreach (Entity entity in (IEnumerable<Entity>) changeSet)
            entity.IsSubmitting = true;
          result = this.DomainClient.BeginSubmit(changeSet, (AsyncCallback) (asyncResult => this._syncContext.Post((SendOrPostCallback) delegate
          {
            this.CompleteSubmitChanges(asyncResult);
          }, (object) null)), (object) submitOperation);
        }
      }
      catch
      {
        this.IsSubmitting = false;
        if (changeSet != null)
        {
          foreach (Entity entity in (IEnumerable<Entity>) changeSet)
            entity.IsSubmitting = false;
        }
        throw;
      }
      return submitOperation;
    }

    [EditorBrowsable(EditorBrowsableState.Never)]
    protected EntityQuery<TEntity> CreateQuery<TEntity>(string queryName, IDictionary<string, object> parameters, bool hasSideEffects, bool isComposable) where TEntity : Entity
    {
      return new EntityQuery<TEntity>(this.DomainClient, queryName, parameters, hasSideEffects, isComposable);
    }

    public LoadOperation<TEntity> Load<TEntity>(EntityQuery<TEntity> query) where TEntity : Entity
    {
      return (LoadOperation<TEntity>) this.Load((EntityQuery) query, LoadBehavior.KeepCurrent, (Action<LoadOperation>) null, (object) null);
    }

    public LoadOperation<TEntity> Load<TEntity>(EntityQuery<TEntity> query, bool throwOnError) where TEntity : Entity
    {
      return this.Load<TEntity>(query, LoadBehavior.KeepCurrent, throwOnError);
    }

    public LoadOperation<TEntity> Load<TEntity>(EntityQuery<TEntity> query, LoadBehavior loadBehavior, bool throwOnError) where TEntity : Entity
    {
      Action<LoadOperation<TEntity>> callback = (Action<LoadOperation<TEntity>>) null;
      if (!throwOnError)
        callback = (Action<LoadOperation<TEntity>>) (op =>
        {
          if (!op.HasError)
            return;
          op.MarkErrorAsHandled();
        });
      return this.Load<TEntity>(query, loadBehavior, callback, (object) null);
    }

    public LoadOperation<TEntity> Load<TEntity>(EntityQuery<TEntity> query, Action<LoadOperation<TEntity>> callback, object userState) where TEntity : Entity
    {
      return this.Load<TEntity>(query, LoadBehavior.KeepCurrent, callback, userState);
    }

    public LoadOperation<TEntity> Load<TEntity>(EntityQuery<TEntity> query, LoadBehavior loadBehavior, Action<LoadOperation<TEntity>> callback, object userState) where TEntity : Entity
    {
      Action<LoadOperation> callback1 = (Action<LoadOperation>) null;
      if (callback != null)
        callback1 = (Action<LoadOperation>) (lo => callback((LoadOperation<TEntity>) lo));
      return (LoadOperation<TEntity>) this.Load((EntityQuery) query, loadBehavior, callback1, userState);
    }

    [EditorBrowsable(EditorBrowsableState.Never)]
    public virtual LoadOperation Load(EntityQuery query, LoadBehavior loadBehavior, Action<LoadOperation> callback, object userState)
    {
      if (query == null)
        throw new ArgumentNullException("query");
      if (this.DomainClient != query.DomainClient)
      {
        throw new InvalidOperationException(string.Format((IFormatProvider) CultureInfo.CurrentCulture, Resource.DomainContext_InvalidEntityQueryDomainClient, new object[1]
        {
          (object) query.QueryName
        }));
      }
      else
      {
        IAsyncResult result = (IAsyncResult) null;
        Action<LoadOperation> action = (Action<LoadOperation>) null;
        if (this.DomainClient.SupportsCancellation)
          action = (Action<LoadOperation>) (op =>
          {
            if (result != null)
              this.DomainClient.CancelQuery(result);
            this.DecrementLoadCount();
          });
        LoadOperation loadOperation = (LoadOperation) DomainContext.createLoadOperationMethod.MakeGenericMethod(new Type[1]
        {
          query.EntityType
        }).Invoke((object) null, new object[5]
        {
          (object) query,
          (object) loadBehavior,
          (object) callback,
          userState,
          (object) action
        });
        this.IncrementLoadCount();
        result = this.DomainClient.BeginQuery(query, (AsyncCallback) (asyncResult => this._syncContext.Post((SendOrPostCallback) delegate
        {
          this.CompleteLoad(asyncResult);
        }, (object) null)), (object) loadOperation);
        return loadOperation;
      }
    }

    private void CompleteLoad(IAsyncResult asyncResult)
    {
      LoadOperation loadOperation = (LoadOperation) asyncResult.AsyncState;
      IEnumerable<Entity> enumerable = (IEnumerable<Entity>) null;
      IEnumerable<Entity> allEntities = (IEnumerable<Entity>) null;
      int totalEntityCount = -1;
      if (loadOperation.IsCanceled)
        return;
      Exception error = (Exception) null;
      QueryCompletedResult queryCompletedResult = (QueryCompletedResult) null;
      try
      {
        lock (this._syncRoot)
        {
          queryCompletedResult = this.DomainClient.EndQuery(asyncResult);
          enumerable = Enumerable.Cast<Entity>(this.EntityContainer.LoadEntities((IEnumerable) queryCompletedResult.Entities, loadOperation.LoadBehavior));
          IEnumerable<Entity> local_6 = Enumerable.Cast<Entity>(this.EntityContainer.LoadEntities((IEnumerable) queryCompletedResult.IncludedEntities, loadOperation.LoadBehavior));
          allEntities = Enumerable.Concat<Entity>(enumerable, local_6);
          totalEntityCount = queryCompletedResult.TotalCount;
        }
      }
      catch (Exception ex)
      {
        if (ExceptionHandlingUtility.IsFatal(ex))
          throw;
        else
          error = ex;
      }
      finally
      {
        this.DecrementLoadCount();
      }
      if (error == null)
      {
        if (Enumerable.Any<ValidationResult>(queryCompletedResult.ValidationErrors))
        {
          loadOperation.Complete(queryCompletedResult.ValidationErrors);
        }
        else
        {
          DomainClientResult queryResult = DomainClientResult.CreateQueryResult(enumerable, allEntities, totalEntityCount, queryCompletedResult.ValidationErrors);
          loadOperation.Complete(queryResult);
        }
      }
      else
        loadOperation.Complete(error);
    }

    private static void ProcessSubmitResults(EntityChangeSet changeSet, IEnumerable<ChangeSetEntry> changeSetResults)
    {
      bool flag = false;
      Dictionary<Entity, List<ValidationResult>> entityErrorMap = new Dictionary<Entity, List<ValidationResult>>();
      foreach (ChangeSetEntry changeSetEntry in changeSetResults)
      {
        if (changeSetEntry.ValidationErrors != null && Enumerable.Any<ValidationResultInfo>(changeSetEntry.ValidationErrors))
        {
          flag = true;
          DomainContext.AddEntityErrors(changeSetEntry.ClientEntity, changeSetEntry.ValidationErrors, entityErrorMap);
        }
        if (changeSetEntry.HasConflict)
        {
          EntityConflict entityConflict = new EntityConflict(changeSetEntry.ClientEntity, changeSetEntry.StoreEntity, changeSetEntry.ConflictMembers, changeSetEntry.IsDeleteConflict);
          changeSetEntry.ClientEntity.EntityConflict = entityConflict;
          flag = true;
        }
      }
      if (flag)
        return;
      DomainContext.ApplyMemberSynchronizations(changeSetResults);
      foreach (IChangeTracking changeTracking in Enumerable.Where<Entity>((IEnumerable<Entity>) changeSet.RemovedEntities, (Func<Entity, bool>) (p =>
      {
        if (p.Parent != null)
          return p.Parent.EntityState != EntityState.Deleted;
        else
          return true;
      })))
        changeTracking.AcceptChanges();
      foreach (IChangeTracking changeTracking in Enumerable.Concat<Entity>((IEnumerable<Entity>) changeSet.AddedEntities, (IEnumerable<Entity>) changeSet.ModifiedEntities))
        changeTracking.AcceptChanges();
    }

    private static void AddEntityErrors(Entity failedEntity, IEnumerable<ValidationResultInfo> errors, Dictionary<Entity, List<ValidationResult>> entityErrorMap)
    {
      List<ValidationResult> list1 = (List<ValidationResult>) null;
      if (!entityErrorMap.TryGetValue(failedEntity, out list1))
      {
        List<ValidationResult> list2 = Enumerable.ToList<ValidationResult>(Enumerable.Select<ValidationResultInfo, ValidationResult>(errors, (Func<ValidationResultInfo, ValidationResult>) (e => new ValidationResult(e.Message, e.SourceMemberNames))));
        entityErrorMap[failedEntity] = list2;
        ValidationUtilities.ApplyValidationErrors((object) failedEntity, (IEnumerable<ValidationResult>) list2);
      }
      else
      {
        foreach (ValidationResultInfo validationResultInfo in errors)
        {
          ValidationResult validationResult = new ValidationResult(validationResultInfo.Message, validationResultInfo.SourceMemberNames);
          if (!Enumerable.Contains<ValidationResult>((IEnumerable<ValidationResult>) list1, validationResult, (IEqualityComparer<ValidationResult>) new ValidationResultEqualityComparer()))
            list1.Add(validationResult);
        }
      }
    }

    private static void ApplyMemberSynchronizations(IEnumerable<ChangeSetEntry> changeSetResults)
    {
      foreach (ChangeSetEntry changeSetEntry in Enumerable.Where<ChangeSetEntry>(changeSetResults, (Func<ChangeSetEntry, bool>) (p => p.Operation != EntityOperationType.Delete)))
      {
        if (changeSetEntry.Entity != null)
          changeSetEntry.ClientEntity.Merge(changeSetEntry.Entity, LoadBehavior.RefreshCurrent);
      }
    }

    private void EntityContainerPropertyChanged(object sender, PropertyChangedEventArgs e)
    {
      if (string.CompareOrdinal(e.PropertyName, "HasChanges") != 0)
        return;
      this.RaisePropertyChanged("HasChanges");
    }

    private void CompleteSubmitChanges(IAsyncResult asyncResult)
    {
      SubmitOperation submitOperation = (SubmitOperation) asyncResult.AsyncState;
      IEnumerable<ChangeSetEntry> source = (IEnumerable<ChangeSetEntry>) null;
      Exception error = (Exception) null;
      try
      {
        foreach (Entity entity in (IEnumerable<Entity>) submitOperation.ChangeSet)
          entity.IsSubmitting = false;
        if (submitOperation.IsCanceled)
          return;
        SubmitCompletedResult submitCompletedResult = this.DomainClient.EndSubmit(asyncResult);
        DomainContext.ProcessSubmitResults(submitCompletedResult.ChangeSet, Enumerable.Cast<ChangeSetEntry>((IEnumerable) submitCompletedResult.Results));
        source = submitCompletedResult.Results;
      }
      catch (Exception ex)
      {
        if (ExceptionHandlingUtility.IsFatal(ex))
          throw;
        else
          error = ex;
      }
      finally
      {
        this.IsSubmitting = false;
      }
      if (submitOperation.IsCanceled)
        return;
      if (error == null)
      {
        if (Enumerable.Any<ChangeSetEntry>(source, (Func<ChangeSetEntry, bool>) (p => p.HasError)))
        {
          if (Enumerable.Any<ChangeSetEntry>(source, (Func<ChangeSetEntry, bool>) (p =>
          {
            if (p.ValidationErrors != null)
              return Enumerable.Any<ValidationResultInfo>(p.ValidationErrors);
            else
              return false;
          })))
          {
            submitOperation.Complete(OperationErrorStatus.ValidationFailed);
          }
          else
          {
            if (!Enumerable.Any<ChangeSetEntry>(source, (Func<ChangeSetEntry, bool>) (p => p.HasConflict)))
              return;
            submitOperation.Complete(OperationErrorStatus.Conflicts);
          }
        }
        else
          submitOperation.Complete();
      }
      else
        submitOperation.Complete(error);
    }

    [EditorBrowsable(EditorBrowsableState.Never)]
    public virtual InvokeOperation<TValue> InvokeOperation<TValue>(string operationName, Type returnType, IDictionary<string, object> parameters, bool hasSideEffects, Action<InvokeOperation<TValue>> callback, object userState)
    {
      if (string.IsNullOrEmpty(operationName))
      {
        throw new ArgumentException(string.Format((IFormatProvider) CultureInfo.CurrentCulture, Resource.Parameter_NullOrEmpty, new object[1]
        {
          (object) "operationName"
        }));
      }
      else
      {
        if (returnType == null)
          throw new ArgumentNullException("returnType");
        IAsyncResult result = (IAsyncResult) null;
        Action<InvokeOperation<TValue>> cancelAction = (Action<InvokeOperation<TValue>>) null;
        if (this.DomainClient.SupportsCancellation)
          cancelAction = (Action<InvokeOperation<TValue>>) (op =>
          {
            if (result == null)
              return;
            this.DomainClient.CancelInvoke(result);
          });
        InvokeOperation<TValue> invokeOperation = new InvokeOperation<TValue>(operationName, parameters, callback, userState, cancelAction);
        result = this.DomainClient.BeginInvoke(new InvokeArgs(operationName, returnType, parameters, hasSideEffects), (AsyncCallback) (asyncResult => this._syncContext.Post((SendOrPostCallback) delegate
        {
          this.CompleteInvoke(asyncResult);
        }, (object) null)), (object) invokeOperation);
        return invokeOperation;
      }
    }

    [EditorBrowsable(EditorBrowsableState.Never)]
    public virtual InvokeOperation InvokeOperation(string operationName, Type returnType, IDictionary<string, object> parameters, bool hasSideEffects, Action<InvokeOperation> callback, object userState)
    {
      if (string.IsNullOrEmpty(operationName))
      {
        throw new ArgumentException(string.Format((IFormatProvider) CultureInfo.CurrentCulture, Resource.Parameter_NullOrEmpty, new object[1]
        {
          (object) "operationName"
        }));
      }
      else
      {
        if (returnType == null)
          throw new ArgumentNullException("returnType");
        IAsyncResult result = (IAsyncResult) null;
        Action<InvokeOperation> action = (Action<InvokeOperation>) null;
        if (this.DomainClient.SupportsCancellation)
          action = (Action<InvokeOperation>) (op =>
          {
            if (result == null)
              return;
            this.DomainClient.CancelInvoke(result);
          });
        InvokeOperation invokeOperation = (InvokeOperation) DomainContext.createInvokeOperationMethod.MakeGenericMethod(new Type[1]
        {
          returnType == typeof (void) ? typeof (object) : returnType
        }).Invoke((object) null, new object[5]
        {
          (object) operationName,
          (object) parameters,
          (object) callback,
          userState,
          (object) action
        });
        result = this.DomainClient.BeginInvoke(new InvokeArgs(operationName, returnType, parameters, hasSideEffects), (AsyncCallback) (asyncResult => this._syncContext.Post((SendOrPostCallback) delegate
        {
          this.CompleteInvoke(asyncResult);
        }, (object) null)), (object) invokeOperation);
        return invokeOperation;
      }
    }

    private void CompleteInvoke(IAsyncResult asyncResult)
    {
      InvokeOperation invokeOperation = (InvokeOperation) asyncResult.AsyncState;
      if (invokeOperation.IsCanceled)
        return;
      Exception error = (Exception) null;
      InvokeCompletedResult invokeCompletedResult = (InvokeCompletedResult) null;
      try
      {
        invokeCompletedResult = this.DomainClient.EndInvoke(asyncResult);
      }
      catch (Exception ex)
      {
        if (ExceptionHandlingUtility.IsFatal(ex))
          throw;
        else
          error = ex;
      }
      if (error == null)
      {
        if (Enumerable.Any<ValidationResult>(invokeCompletedResult.ValidationErrors))
        {
          invokeOperation.Complete(invokeCompletedResult.ValidationErrors);
        }
        else
        {
          DomainClientResult invokeResult = DomainClientResult.CreateInvokeResult(invokeCompletedResult.ReturnValue, invokeCompletedResult.ValidationErrors);
          invokeOperation.Complete(invokeResult);
        }
      }
      else
        invokeOperation.Complete(error);
    }

    protected void RaisePropertyChanged(string propertyName)
    {
      if (string.IsNullOrEmpty(propertyName))
        throw new ArgumentNullException("propertyName");
      if (this.PropertyChanged == null)
        return;
      this.PropertyChanged((object) this, new PropertyChangedEventArgs(propertyName));
    }

    private void IncrementLoadCount()
    {
      Interlocked.Increment(ref this._activeLoadCount);
      if (this._activeLoadCount != 1)
        return;
      this.RaisePropertyChanged("IsLoading");
    }

    private void DecrementLoadCount()
    {
      Interlocked.Decrement(ref this._activeLoadCount);
      if (this._activeLoadCount != 0)
        return;
      this.RaisePropertyChanged("IsLoading");
    }

    protected void ValidateMethod(string methodName, IDictionary<string, object> parameters)
    {
      if (string.IsNullOrEmpty(methodName))
        throw new ArgumentNullException("methodName");
      object[] objArray = parameters != null ? Enumerable.ToArray<object>((IEnumerable<object>) parameters.Values) : new object[0];
      if (!this.MethodRequiresValidation(methodName, objArray))
        return;
      ValidationContext validationContext = ValidationUtilities.CreateValidationContext((object) this, this.ValidationContext);
      ValidationUtilities.ValidateMethodCall(methodName, validationContext, objArray);
    }

    private bool ValidateChangeSet(EntityChangeSet changeSet, ValidationContext validationContext)
    {
      if (!changeSet.Validate(validationContext))
        return false;
      foreach (Entity entity in changeSet.ModifiedEntities)
      {
        EntityAction entityAction = Enumerable.FirstOrDefault<EntityAction>(entity.EntityActions);
        if (entityAction != null)
        {
          try
          {
            object[] parameters = new object[Enumerable.Count<object>(entityAction.Parameters) + 1];
            parameters[0] = (object) entity;
            int num = 1;
            foreach (object obj in entityAction.Parameters)
              parameters[num++] = obj;
            ValidationUtilities.GetMethod((object) this, entityAction.Name, parameters);
          }
          catch (MissingMethodException ex)
          {
            throw new InvalidOperationException(string.Format((IFormatProvider) CultureInfo.CurrentCulture, Resource.DomainContext_NamedUpdateMethodDoesNotExist, (object) entityAction.Name, (object) entity.GetType(), (object) this.GetType()), (Exception) ex);
          }
        }
      }
      return true;
    }

    private bool MethodRequiresValidation(string methodName, object[] paramValues)
    {
      bool flag = false;
      if (!this.requiresValidationMap.TryGetValue(methodName, out flag))
      {
        flag = ValidationUtilities.MethodRequiresValidation(ValidationUtilities.GetMethod((object) this, methodName, paramValues));
        this.requiresValidationMap[methodName] = flag;
      }
      return flag;
    }
  }
}
